define([], function() {
	return{
		title:['<a href="user.html">个人中心</a>', "认证中心", "资质认证"],
		init:function(content){
			let form = content.children("form");
			let table = content.children("table");
			let search = [];
			let infoCertificateTypeId = content.find("select[name='infoCertificateTypeId']");
			let productTemplate = content.find("._productTemplate");
			let tableInit = function(){
				let actionEvent = {
						"click .temp2": function(e, value, row) {
							toastr.info("查看详情[" + row.userRealName + "]开发中...");
						},
						"click .temp1": function(e, value, row) {
							$.post(
								"user/modify-pwd.do", {
									"userName": row.userName,
									"userPwd": "123456"
								},
								function(data) {
									if(data.ok) {
										toastr.success("重置密码为:123456");
									} else {
										toastr.error("设置锁定状态失败：" + data.message);
									}
								}, "json"
							);
						},
						"change .infoAddress": function(e, value, row) {
							e.target.disabled = true;
							$.post(
								"user/modify.do", {
									"userName": row.userName,
									"infoAddress": e.target.checked
								},
								function(data) {
									e.target.disabled = false;
									if(data.ok) {
										toastr.success("设置锁定状态成功");
									} else {
										toastr.error("设置锁定状态失败：" + data.message);
									}
								}, "json"
							);
						},
						"change .typeName": function(e, value, row) {
							e.target.disabled = true;
							$.post(
								"certificate/certificateInfoListAll.do", {
									"infoId": row.infoId,
									"typeName": e.target.value
								},
								function(data) {
									e.target.disabled = false;
									if(data.ok) {
										toastr.success("设置角色成功");
									} else {
										toastr.error("设置角色失败：" + data.message);
									}
								}, "json"
							);
						},
						".infoCertificateTypeId":function(e,value,row){
							if(row.infoCertificateTypeId == 1){
								e.target.value ="sss";
							}
						},
						"click .temp": function(e, value, row) {}
				};
				table.bootstrapTable({
					
					url:'certificate/certificaterzs-res-ajax.do', // 表格数据来源
					method:"get",
					sidePagination: "server", //分页方式：client客户端分页，server服务端分页（*）
					pageNumber: 1, //初始化加载第一页，默认第一页
					pageSize: 10, //每页的记录行数（*）
					pageList: [5, 10, 15, 20, 30, 50], //可供选择的每页的行数（*）
					pagination: true, //是否显示分页（*）
					dataField: "list",
					toolbar: form,
					queryParamsType: "",
					queryParams: function(p) {
						let ps = [].concat(search);
						ps.push({
							"name": "current",
							"value": p.pageNumber
						});
						ps.push({
							"name": "rowMax",
							"value": p.pageSize
						});
						ps.push({
							"name": "sortName",
							"value": p.sortName
						});
						ps.push({
							"name": "sortOrder",
							"value": p.sortOrder
						});
						return ps;
					},
					columns:[{
						field: 'infoCertificateId',
						title: '证书编号',
						align: "center",
						sortable: true,
						sortName: "info_certificate_id",
						width: 100
					},{
						field: 'infoName',
						title: '姓名',
						align: "center",
						sortable: true,
						sortName: "info_Name",
						width: 40
					},{
						field: 'infoCard',
						title: '身份证号',
						align: "center",
						sortable: true,
						sortName: "info_Card",
						width: 40
					},{
						field: 'infoGrade',
						align: "center",
						title: '成绩',
						sortable: true,
						sortName: "info_Grade",
						width: 40,
						
					},{
						field: 'infoPass',
						align: "center",
						title: '是否通过',
						sortable: true,
						sortName: "info_Pass",
						width: 40,
						
					},{
						field: 'infoRemark',
						align: "center",
						title: '考试评语',
						sortable: true,
						sortName: "info_remark",
						width: 40,
						
					},{
						field: 'infoExamUsername',
						align: "center",
						title: '报考用户名',
						sortable: true,
						sortName: "info_exam_username",
						width: 40,
						
					},{
						field: 'infoRzsUsername',
						align: "center",
						title: '认证师用户名',
						sortable: true,
						sortName: "info_rzs_username",
						width: 40,
						
					},{
						field: 'infoStatus',
						align: "center",
						title: '认证状态',
						sortable: true,
						sortName: "info_status",
						width: 40,
						
					},{
						field: 'infoMoney',
						align: "center",
						title: '报考金额',
						sortable: true,
						sortName: "info_money",
						width: 40,
						
					},{
						field: 'temp1',
						align: "center",
						title: '操作',
						width: 100,
						events: actionEvent,
						formatter: function(value, row, index, field) {
							return '<a " href="/certificate/update.do?infoId=${certificate.infoId};">操作</a>';
						}
					},]
				});
			};
			form.on("submit",function(){
				search = form.serializeArray();
				table.bootstrapTable('refresh');
				console.info(submit);
				return false;
				
			});
			
			tableInit();
			
			
		}
	}
});